import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';






class LoginSuccessPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: LoginSuccessPage2(title: "LoginSuccessPage"),
    );
  }
}

class LoginSuccessPage2 extends StatefulWidget {
  // LoginSuccessPage2({Key key, this.title}) : super(key: key);
  final String title;

  LoginSuccessPage2({this.title});

  @override
  _LoginSuccessPage2State createState() => _LoginSuccessPage2State();
}

class _LoginSuccessPage2State extends State<LoginSuccessPage2>{

  TextEditingController _editingController0=new TextEditingController();//用户名栏的控制器
  String userName;


  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("LoginSuccessPage", style: TextStyle(),),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Align(
              alignment: Alignment.topLeft,
              child: Column(
                children: <Widget>[
                  Align(
                      alignment: Alignment.topLeft,
                      child: Padding(
                        padding: EdgeInsets.fromLTRB(20, 20,0,0),
                        child: Image.asset(
                          "images/baidu_logo.png",
                          width: 120,
                        ),
                      )
                  ),
                  Align(
                      alignment: Alignment.topLeft,
                      child: Padding(
                        padding: EdgeInsets.fromLTRB(20, 0,0,0),
                        child: Text(
                          "欢迎使用百度帐户",
                          textAlign: TextAlign.left,
                          style: TextStyle(
                              fontSize: 30,
                              fontWeight: FontWeight.bold
                          ),
                        ),
                      )
                  ),
                ],
              ),
            ),
            SizedBox(height: 100,),
            Padding(
                padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
                child: Container(
                  height: 60,
                  child: TextField(
                    controller: _editingController0,
                    keyboardType: TextInputType.url,
                    maxLines: 1,//最大行数
                    // maxLength: 30,//最大长度
                    decoration: InputDecoration(
                      // labelText: "账户名/手机号/邮箱",
                      // labelStyle: TextStyle(
                      //   color: Colors.grey,
                      //   fontSize: 16
                      // ),
                      // hintText: "输入...",
                        hintText: "...",
                        hintStyle: TextStyle(fontSize: 16),
                        fillColor: Colors.black12,//背景颜色，必须配合filled为true才能显示
                        filled: true,//背景颜色，必须配合fillColor才能显示
                        border: OutlineInputBorder(
                            borderRadius: BorderRadius.all(Radius.circular(10)),
                            borderSide: BorderSide.none
                        )
                    ),
                  ),
                )
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 20, 20, 0),
              child: RaisedButton(
                color: Colors.blue,
                child: Container(
                  alignment: Alignment.center,
                  child: Text('注  销',
                    style: TextStyle(fontSize: 20,color: Colors.white),
                  ),
                  height: 60,
                ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10),
                ),
                onPressed: () async {
                  SharedPreferences prefs = await SharedPreferences.getInstance();
                  prefs.remove(widget.title);
                  Navigator.of(context).pop();
                  // prefs.clear();
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}